import time

from cache.redis_util import getConnection
from cache.redis_util import getLock


proxy_data = {
    "proxy_address" : 'proxy_address.text',
    "proxy_uname" : 'proxy_uname',
    "proxy_pass": 'proxy_pass'
}
# 将代理信息写入缓存 设置2分钟超时时间
redis = getConnection('prod')
name = f'stock:proxy:ex'

redis.hset(name=name,key='proxy_address',value='1')
redis.hset(name=name,key='proxy_uname',value='2')
redis.hset(name=name,key='proxy_pass',value='2')
redis.expire(name=name,time=10)

print(redis.exists('stock:proxy:ex'))
proxy_host = redis.hget(name='stock:proxy:ex',key='proxy_host')
proxy_port = redis.hget(name='stock:proxy:ex',key='proxy_port')
proxy_uname = redis.hget(name='stock:proxy:ex',key='proxy_uname')
proxy_pass = redis.hget(name='stock:proxy:ex',key='proxy_pass')
print(proxy_host)
print(proxy_port)
print(proxy_uname)
print(proxy_pass)






